import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Test {
    static int sum=1;

    public static void main(String[] args) throws Exception {
        File file = new File("E:\\CRM\\survey\\src\\main\\java\\com\\gp");
        line(file);
        System.out.println(sum);
    }

    public static void line(File file) throws Exception {
        File[] files = file.listFiles();
        for (File f : files) {
            if (f.isFile()){
                System.out.println(f.getName());
                if (f.getName().endsWith(".java")){
                FileInputStream fin = new FileInputStream(f);
                int x;
                while ((x=fin.read())!=-1){
                    if ((char)x=='\n')
                        sum++;
                }
                fin.close();
                }
            }else {
                File file1 = new File(f.getAbsolutePath());
                line(file1);
            }
        }
    }
}
